/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xos_ffmpeg.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __IMPL_MGR_H__
#define __IMPL_MGR_H__

//////////////////////////////////////////////////////////////////////////////////
// 

namespace xos_ffmpeg
{
    class sdl2_impl;

    class mgr : public xos_box::i_callback
    {
    public:
        typedef xos::release_impl< mgr > T;

    public:
        mgr();
        ~mgr();

    public:
        static xos_container::i_container * container();
        static mgr * get();

    public:
        // 
        // xos_box::i_callback method
        // 
        int notify( xos_box::i_msg*& p );
        int size();

    public:
        int heart();
        int run();

    protected:
        xos_box::i_lock_free_queue * m_pQueue;
        xos_box::i_lock_num * m_pNum;
        xos::i_event* m_pEvent;
        sdl2_impl * m_pSdl2;

    protected:
        int put_back_to_pool();
        int init();
        int term();

    protected:
        int loop();
        int proc();

    };
} // xos_ffmpeg

#endif // __IMPL_MGR_H__
